#!/usr/bin/env node

const fs=require('fs'),
      fileName=process.argv[2],
      log=console.log;
//底层API打印文件内容
let fid=fs.openSync(fileName,'r'),
    size=fs.statSync(fileName).size,
    buf=new Buffer(size);
try{
  fs.readSync(fid,buf,0,size,0);
  log(buf.toString('utf8'));
  fs.closeSync(fid);
}catch(e){
  log(e.message);
}
